#include <stdint.h>
#include "fips202.h"

#define AES256_BLOCKLEN 64// buffer size for gen_a
#define REJ_BLOCKLEN ((8*DIM_N/8*(1<<8)/Q + AES256_BLOCKLEN) / AES256_BLOCKLEN)
// #define REJ_BLOCKLEN 9

//generate the public parameter a from seed
int gen_a(unsigned char *a,  const unsigned char *seed);
//generate the small random vector for secret and error
int gen_e(unsigned char *e, keccak_state *state);

// poly_mul  b=[as]
int poly_mul(const unsigned char *a, const unsigned char *s, unsigned char *b, unsigned int  vec_num);
// poly_aff  b=as+e 
int poly_aff(const unsigned char *a, const  unsigned char *s, unsigned char *e, unsigned char *b, unsigned int vec_num);
// Compression: c1 discards 1-bit
int poly_compress_c1_1bit(const unsigned char *in,  unsigned char *out, const unsigned int vec_num);
int poly_decompress_c1_1bit(const unsigned char *in,  unsigned char *out, const unsigned int vec_num);
// Compression: c2 discards 4-bit
int poly_compress_c2_4bit(const unsigned char *in,  unsigned char *out, const unsigned int vec_num);
int poly_decompress_c2_4bit(const unsigned char *in,  unsigned char *out, const unsigned int vec_num);
// Compression: c2 discards 5-bit
int poly_compress_c2_5bit(const unsigned char *in,  unsigned char *out, const unsigned int vec_num);
int poly_decompress_c2_5bit(const unsigned char *in,  unsigned char *out, const unsigned int vec_num);
